package com.qfmy.app.controller.novel;

import com.qfmy.app.service.novel.CategoryService;
import com.qfmy.app.vo.novel.CategoryVo;
import com.qfmy.common.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.app.controller.novel
 * @date 2025/4/14
 * @description 小说分类控制类
 */
@RestController
@RequestMapping("/app/category")
@SuppressWarnings("all")
public class CategoryController {

    /**
     * 注入service
     */
    @Resource
    private CategoryService categoryService;

    /**
     * 根据类型获取分类
     */
    @RequestMapping("/getCategoryByType")
    public Result<List<CategoryVo>> getCategoryByType(@RequestParam Integer type) {
        List<CategoryVo> categoryVos = categoryService.getCategoryByType(type);
        return Result.ok(categoryVos);
    }

}
